<!DOCTYPE html>
<html  lang="zh-CN">
<head>
  <meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"/>
  <meta content=always name=referrer>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <meta name="format-detection" content="telephone=no"/>
  <meta name="keywords" content=""/>
  <meta name="description" content=""/>
  <title>支付</title>
  <link rel="stylesheet" type="text/css" href="__STATIC__/css/bootstrap.min.css">
  <link rel="stylesheet" type="text/css" href="__STATIC__/css/swiper.min.css">
  <link rel="stylesheet" type="text/css" href="__STATIC__/css/base.css">
  <script src="__STATIC__/js/jquery-1.11.3.min.js"></script>
  <script src="__STATIC__/js/common.js"></script>
  <script src="__STATIC__/js/jquery.form.min.js"></script>
  <script src="__STATIC__/layer/layer.js"></script>
  <script src="__STATIC__/js/Validform_v5.3.2_min.js"></script>
  <script src="__STATIC__/js/Validform_Datatype.js"></script>
  <script src="__STATIC__/dialog/js/mh_dialog.js"></script>
</head>
<body>
<div class="wrap">
  <div class="payment_con">
    <div class="payment_title">成功提交订单</div>
    <div class="payment_main">
      <div class="order_det">
        <div class="title">请选择支付方式！</div>
        <div class="det">订单号：{$order_number}<br>
          下单时间：{:date('Y-m-d H:i:s',$info_time)}<br>
          </div>
      </div>

    </div>
    <div class="payment_title">平台支付<div class="number right">需支付金额：<span>￥{$price}</span></div></div>
    <div class="payment_main">
      <!--<ul class="list_payment">-->
        <!--<li>-->
          <!--<input type="radio" class="radio" id="radio_1" name="radio-1-set" value="支付宝"/>-->
          <!--<label for="radio_1"><img src="__STATIC__/img/icon76.png"></label>-->
        <!--</li>-->
        <!--<li>-->
          <!--<input type="radio" class="radio" id="radio_2" name="radio-1-set" value="微信"/>-->
          <!--<label for="radio_2"><img src="__STATIC__/img/icon77.png"></label>-->
        <!--</li>-->
        <!--<li>-->
          <!--<input type="radio" class="radio" id="radio_3" name="radio-1-set" value="余额支付" checked/>-->
          <!--<label for="radio_3"><img src="__STATIC__/img/icon78.png"></label>-->
        <!--</li>-->
      <!--</ul>-->
      <input type="hidden" id="order_number" value="{$order_number}">
      <input type="hidden" id="price" value="{$price}">
      <input type="hidden" id="information_wechat" value="{$information_wechat}">
      <input type="hidden" id="information_alipy" value="{$information_alipy}">
      <input type="hidden" id="good_ids" value="{$goods_id}">
      <input type="submit" class="submit" value="立即支付" onclick="payment_order()">
    </div>
    <div id="alipay" hidden></div>
  </div>
</div>
<script>
  // 判断支付方式
  function payment_order() {
    var way = $("input[name='radio-1-set']:checked").val();
    if (way=='余额支付') {
      balance_payment(way);
    }else if(way=='微信'){
      wechat_payment(way);
    }else {
      alipay_payment(way);
    }
  }

  // 余额支付功能
  function balance_payment(way) {
    // 获取订单号shop_order_number
    var order_number = $("#order_number").val();
    // 跳转到余额支付页面
    location.href ="{:url('shop/payment/payment_order')}?order_number="+order_number;


  }

  // 支付宝支付
  function alipay_payment() {
    var order_number = $("#order_number").val();
    var information = $("#information_alipy").val();

    $.ajax({
      url : "{:url('shop/Alipay/pay')}",
      type:'post',
      dataType:'html',
      data:{'order_number':order_number,'body' : information},
      success:function (data) {
        $('#alipay').html(data);
      },
      error: function () {
        layer.open({content:'网络繁忙,请重试',skin:'msg',time:2});
      }
    })

  }

  // 微信支付
  function wechat_payment() {
    var order_number = $("#order_number").val();
    var information = $("#information_wechat").val();
    var goods_id = $('#good_ids').val();
    location.href = "{:url('shop/WeChat/pay')}?order_number="+order_number+"&body="+information+"&goods_id="+goods_id;
  }
</script>
</body>
</html>
